package Test_07_03;
//计算机学院需要开发一个本院教工信息管理系统，教工人员有三类：教师（Teacher）、行政(Officer)、教师兼行政(TOfficer)。
// 教工人员共有的信息包括：姓名、性别、年龄、职称、工资等级。
// 其中，教师还包含的信息有：专业；
// 行政人员还包含的信息有：职务。请创建相关信息类，并实现下述功能：
//（1）根据职称自动计算工资等级。所有教工的基础工资等级(SalaryDegree)计算公式：若职称为正高(Senior)，工资等级为5000；副高(ViceSenior)，4100；中级(Middle)：3200；初级(Primary)：2300。在此基础上，教师兼行政人员工资等级上浮半级，即增加450。
//（2）按照格式输出教工信息。
//注意：不按要求设计类和继承关系都不得分。
//输入
//共3位教工，输入格式如样例所示。
//输出
//从3位教工中，选择工资等级最高的教师（保证只有一个），输出其相关信息。输出格式如样例所示。
//难度
//中等
//输入示例
//Teacher 张三 男 35 Middle 计算机
//Officer 李四 男 25 Primary 科员
//TOfficer 王五 女 30 Middle 计算机 主任科员
//输出示例
//王五,女,Middle,SalaryDegree:3650.

import java.util.*;

// 教工类
class Staff {
    protected String name;
    protected String gender;
    protected int age;
    protected String title;
    protected int salaryDegree;

    public Staff(String name, String gender, int age, String title) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.title = title;
        calculateSalaryDegree();
    }

    protected void calculateSalaryDegree() {
        switch (title) {
            case "Senior":
                salaryDegree = 5000;
                break;
            case "ViceSenior":
                salaryDegree = 4100;
                break;
            case "Middle":
                salaryDegree = 3200;
                break;
            case "Primary":
                salaryDegree = 2300;
                break;
            default:
                salaryDegree = 0;
                break;
        }
    }

    public int getSalaryDegree() {
        return salaryDegree;
    }

    public String toString() {
        return name + "," + gender + "," + title + ",SalaryDegree:" + salaryDegree;
    }
}

// 教师类
class Teacher extends Staff {
    private String specialty;

    public Teacher(String name, String gender, int age, String title, String specialty) {
        super(name, gender, age, title);
        this.specialty = specialty;
    }

    public String toString() {
        return super.toString() + " " + specialty;
    }
}

// 行政人员类
class Officer extends Staff {
    private String position;

    public Officer(String name, String gender, int age, String title, String position) {
        super(name, gender, age, title);
        this.position = position;
    }

    public String toString() {
        return super.toString() + " " + position;
    }
}

// 教师兼行政人员类
class TOfficer extends Teacher {
    private String position;

    public TOfficer(String name, String gender, int age, String title, String specialty, String position) {
        super(name, gender, age, title, specialty);
        this.position = position;
    }

    public String toString() {
        return super.toString() + " " + position;
    }
}

public class Main2 {
    public static void main(String[] args) {
        List<Staff> staffList = new ArrayList<>();

        // 输入示例教工信息
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            String type = scanner.next();
            String name = scanner.next();
            String gender = scanner.next();
            int age = scanner.nextInt();
            String title = scanner.next();

            if (type.equals("Teacher")) {
                String specialty = scanner.next();
                staffList.add(new Teacher(name, gender, age, title, specialty));
            } else if (type.equals("Officer")) {
                String position = scanner.next();
                staffList.add(new Officer(name, gender, age, title, position));
            } else if (type.equals("TOfficer")) {
                String specialty = scanner.next();
                String position = scanner.next();
                staffList.add(new TOfficer(name, gender, age, title, specialty, position));
            }
        }
        scanner.close();

        // 找到工资等级最高的教师
        Staff maxSalaryStaff = null;
        int maxSalary = Integer.MIN_VALUE;
        for (Staff staff : staffList) {
            if (staff instanceof Teacher && staff.getSalaryDegree() > maxSalary) {
                maxSalary = staff.getSalaryDegree();
                maxSalaryStaff = staff;
            }
        }

        // 输出结果
        System.out.println(maxSalaryStaff);
    }
}
